package com.xzc.java8.B_Stream.e_map;

import java.util.ArrayList;
import java.util.List;

import static java.util.stream.Collectors.*;

public class MapTest {

    public static void main(String[] args) {
        List<Apple> list0 = new ArrayList<>();
        Apple a0 = new Apple("red");
        Apple a1 = new Apple("blue");
        Apple a2 = new Apple("yellow");
        list0.add(a0);
        list0.add(a1);
        list0.add(a2);

        List<String> list1 = list0.stream().map(Apple::getColor).collect(toList());
        System.out.println(list1);
    }
}
